home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_lib.arc / FLSETATR.C < prev    next >
Text File  |  1990-08-09  |  1KB  |  56 lines

  1. /**
  2. *
  3. *  Name         flsetatr -- Set file attributes
  4. *
  5. *  Synopsis     ercode = flsetatr(pfile,attrib);
  6. *               int  ercode       Returned DOS function error code
  7. *               char *pfile       File path name
  8. *               int  attrib       File attribute
  9. *
  10. *  Description  This function sets the file attribute of the specified
  11. *               file.  See FLCREATE for the possible attributes.  Note
  12. *               that the attribute of subdirectories may not be reset.
  13. *
  14. *  Returns      ercode            DOS 2.0 function return error code
  15. *
  16. *  Version      1.1  (C)Copyright Blaise Computing Inc.  1983, 1984
  17. *
  18. **/
  19. #include <compiler.h>
  20.  
  21. struct dreg
  22. {
  23.   unsigned ax,bx,cx,dx,si,di,ds,es;
  24. };
  25. #define DOSREG  struct dreg
  26.  
  27. int flsetatr(pfile,attrib)
  28. char *pfile;
  29. int  attrib;
  30. {
  31.  
  32.     DOSREG dos_reg;
  33.     int    utinit(),dos();
  34. #if CI201A & LDATA
  35.     unsigned long ptrtoabs();
  36. #endif
  37.  
  38.     utinit(&dos_reg);                  /* Initialize registers         */
  39.     dos_reg.ax = 0x4301;               /* Function 43, set attribute   */
  40.     dos_reg.cx = (unsigned)attrib;
  41. #if LDATA
  42. #if CI201A
  43.     dos_reg.ds = (unsigned)((ptrtoabs(pfile) & 0xffff0L) >> 4L);
  44.     dos_reg.dx = (unsigned)(ptrtoabs(pfile) & 0xfL);
  45. #else
  46.     dos_reg.ds = (unsigned)(((long)(pfile) & 0xffff0L) >> 4L);
  47.     dos_reg.dx = (unsigned)((long)(pfile) & 0xfL);
  48. #endif
  49. #else
  50.     dos_reg.dx = (unsigned)pfile;
  51. #endif
  52.  
  53.     return(dos(&dos_reg));
  54.  
  55. }
  56.